const i18NT = window.$app.t,
  ellipsis = true,
  tooltip = true;

export const WF_STATUS = {
  NEW: '10',
  PUB: '20',
};

export const WF_STATUS_TEXT = {
  [WF_STATUS.NEW]: i18NT('statusCreate'),
  [WF_STATUS.PUB]: i18NT('statusRelease'),
};

export const convertStatus = (arg: string) => {
  return WF_STATUS_TEXT[arg];
};

export const MAIN_TABLE_CONFIG = [
  { title: i18NT('workflowNumber'), dataIndex: 'workflowNumber', width: 150, ellipsis, tooltip },
  { title: i18NT('workflowName'), dataIndex: 'name', width: 150, ellipsis, tooltip },
  { title: i18NT('moduleName'), dataIndex: 'moduleName', width: 150, ellipsis, tooltip },
  { title: i18NT('workflowCategoryDesc'), dataIndex: 'workflowCategoryDesc', width: 150, ellipsis, tooltip },
  { title: i18NT('formName'), dataIndex: 'formName', width: 150, ellipsis, tooltip },
  { title: i18NT('status'), dataIndex: 'status', width: 100, ellipsis, tooltip },
  { title: i18NT('workflowNameEn'), dataIndex: 'nameEn', width: 150, ellipsis, tooltip },
  { title: i18NT('updatedAt'), dataIndex: 'updatedAt', format: 'time', width: 150, ellipsis, tooltip },
  { title: i18NT('action'), dataIndex: 'action', width: 120, fixed: 'right' },
];

export const ROLE_TABLE_CONFIGS = [{ title: i18NT('role'), dataIndex: 'roleName' }];

export const ROLE_TABS_CONFIGS = [
  { label: i18NT('bpmnContent'), id: 'BpmnContent' },
  { label: i18NT('formDesign'), id: 'FormDesign' },
  { label: i18NT('role'), id: 'Role' },
];

// export const formItems = (disabled: boolean) => [
//   { name: 'workflowCode', required, disabled },
//   { name: 'name', required },
//   {
//     name: 'workflowCategoryCode',
//     label: i18NT('workflowCategoryDesc'),
//     type: FCT.COMPANY_SELECT,
//     required,
//     options: {
//       code: 'WFL_CATEGORY',
//       extra: ['codeDesc:workflowCategoryDesc'],
//     },
//   },
//   {
//     name: 'moduleCode',
//     label: i18NT('moduleName'),
//     type: FCT.SELECT,
//     required,
//     options: {
//       url: '/bk/api/company/CompanyFunction/find',
//       fieldNames: { label: 'serviceModuleName', value: 'serviceModuleCode' },
//       extra: ['serviceModuleName:moduleName'],
//     },
//   },
//   {
//     name: 'workflowTypeCode',
//     label: i18NT('workflowType'),
//     type: FCT.COMPANY_SELECT,
//     required,
//     options: {
//       code: 'WFL_TYPE',
//       extra: ['codeDesc:workflowTypeName'],
//     },
//   },
//   {
//     name: 'formId',
//     label: i18NT('/form'),
//     type: FCT.MODAL_TABLE,
//     required: '{{workflowCategoryCode}}==10',
//     options: {
//       width: 800,
//       model: {
//         title: i18NT('formDesign'),
//         url: '/bk/api/fd/Form/find',
//         columns: [
//           { dataIndex: 'formName', ellipsis: true, tooltip: true },
//           { dataIndex: 'formDesc', ellipsis: true, tooltip: true },
//           { dataIndex: 'createdAt', format: 'time' }
//         ],
//         fieldNames: { label: 'formName', value: 'id' },
//         searchFields: ['formName', 'formDesc'],
//         searchFieldsText: [i18NT('formName'), i18NT('formDesc')]
//       }
//     },
//   },
//   {
//     name: 'businessName',
//     type: FCT.SELECT,
//     ghost: '{{workflowCategoryCode}}!=10',
//     required,
//     options: {
//       url: '/bk/api/fd/Form/findOne',
//       fieldNames: { label: 'name', value: 'fieldName' },
//       query: '{"where":{"id": {{formId}}}}',
//       rtnDataAfter: formContentToObj,
//     },
//   },
//   {
//     name: 'businessComment',
//     type: FCT.SELECT,
//     ghost: '{{workflowCategoryCode}}!=10',
//     required,
//     options: {
//       url: '/bk/api/fd/Form/findOne',
//       fieldNames: { label: 'name', value: 'fieldName' },
//       query: '{"where":{"id": {{formId}}}}',
//       rtnDataAfter: formContentToObj,
//     },
//   },
// ];

export const defVars = [
  { fieldName: 'creatorName', name: '姓名', type: 'string' },
  { fieldName: 'creatorPosition', name: '岗位编码', type: 'string' },
  { fieldName: 'creatorPositionName', name: '岗位描述', type: 'string' },
  { fieldName: 'creatorDeptCode', name: '部门编码', type: 'string' },
  { fieldName: 'creatorDeptName', name: '部门描述', type: 'string' },
  { fieldName: 'creatorCostCenterCode', name: '成本中心', type: 'string' }
];